//
//  NSDecimalNumber+XXExtension.h
//  SHWheel
//
//  Created by YYKJ on 2020/11/20.
//  Copyright © 2020 YYKJ. All rights reserved.
//  Source: https://github.com/ReverseScale/DecimalNumberDemo

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

typedef NS_ENUM(NSInteger, CalculationType) {
    Add,
    Subtract,
    Multiply,
    Divide
};

@interface NSDecimalNumber (XXExtension)

+ (NSDecimalNumber *)decimalNumberWithStringOrNumberOrDecimalNumber:(id)stringOrNumber1
                                                                type:(CalculationType)type
               anotherDecimalNumberWithStringOrNumberOrDecimalNumber:(id)stringOrNumber2
                                             andDecimalNumberHandler:(NSDecimalNumberHandler * __nullable)handler;

+ (NSComparisonResult)decimalNumberWithStringOrNumberOrDecimalNumber:(id)stringOrNumber1
         compareAnotherDecimalNumberWithStringOrNumberOrDecimalNumber:(id)stringOrNumber2;

+ (NSString *)stringWithDecimalNumber:(NSDecimalNumber *)str1 scale:(NSInteger)scale;

extern NSComparisonResult StrNumCompare(id str1,id str2);

extern NSDecimalNumber *handlerDecimalNumber(id strOrNum, NSRoundingMode mode, int scale);

extern NSComparisonResult XXCompare(id strOrNum1,id strOrNum2);

extern NSDecimalNumber *XXAdd(id strOrNum1, id strOrNum2);
extern NSDecimalNumber *XXSub(id strOrNum1, id strOrNum2);
extern NSDecimalNumber *XXMul(id strOrNum1, id strOrNum2);
extern NSDecimalNumber *XXDiv(id strOrNum1, id strOrNum2);

extern NSDecimalNumber *XXMin(id strOrNum1, id strOrNum2);
extern NSDecimalNumber *XXMax(id strOrNum1, id strOrNum2);

extern NSDecimalNumber *XXAdd_handler(id strOrNum1, id strOrNum2, NSRoundingMode mode, int scale);
extern NSDecimalNumber *XXSub_handler(id strOrNum1, id strOrNum2, NSRoundingMode mode, int scale);
extern NSDecimalNumber *XXMul_handler(id strOrNum1, id strOrNum2, NSRoundingMode mode, int scale);
extern NSDecimalNumber *XXDiv_handler(id strOrNum1, id strOrNum2, NSRoundingMode mode, int scale);

extern NSDecimalNumber *XXMin_handler(id strOrNum1, id strOrNum2, NSRoundingMode mode, int scale);
extern NSDecimalNumber *XXMax_handler(id strOrNum1, id strOrNum2, NSRoundingMode mode, int scale);

@end

NS_ASSUME_NONNULL_END
